package com.eling.elcms.travel.model;

import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.dao.hibernate.OrderCriteriaEnhancer;
import com.eling.elcms.core.model.BaseModel;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

import javax.persistence.*;
import java.util.Set;

/**
 * 散客团预约
 * 
 * @author zhoulin
 *
 */
@Entity
@Table(name = "travel_nonmemgroupreserve")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = {
		@CriteriaEnhancer(impl = OrderCriteriaEnhancer.class, parameter = "nonMemberGroup.checkInDate:desc")
		 })
public class NonMemGroupReserve extends BaseModel {

	private static final long serialVersionUID = -653760030999000935L;

	@Id
	@In
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	private Long pkNonMemGroupReserve;

	/** 散客团 */
	@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
	@JoinColumn(name = "pkNonMemberGroup")
	@IndexedEmbedded(depth = 1)
	private NonMemberGroup nonMemberGroup;

	/** 预约房型信息 */
	@OneToMany
	@JoinColumn(name = "pkNonMemGroupReserve")
	@IndexedEmbedded(depth = 1)
	private Set<SignUpRoom> signUpRooms;

	@Version
	private Integer version;

	public Long getPkNonMemGroupReserve() {
		return pkNonMemGroupReserve;
	}

	public void setPkNonMemGroupReserve(Long pkNonMemGroupReserve) {
		this.pkNonMemGroupReserve = pkNonMemGroupReserve;
	}

	public NonMemberGroup getNonMemberGroup() {
		return nonMemberGroup;
	}

	public void setNonMemberGroup(NonMemberGroup nonMemberGroup) {
		this.nonMemberGroup = nonMemberGroup;
	}

	public Set<SignUpRoom> getSignUpRooms() {
		return signUpRooms;
	}

	public void setSignUpRooms(Set<SignUpRoom> signUpRooms) {
		this.signUpRooms = signUpRooms;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}
